package org.dftproject.genesis.ui.pages;

import org.dftproject.genesis.ui.GenesisResources;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.text.FlowPage;
import org.eclipse.draw2d.text.ParagraphTextLayout;
import org.eclipse.draw2d.text.TextFlow;
import org.eclipse.jface.resource.JFaceResources;

public class PageUtils {

	public static Label createH1Label(String text) {
		Label label = new Label(text);
		label.setFont(JFaceResources.getFont(GenesisResources.H1_FONT));
		label.setLabelAlignment(PositionConstants.LEFT);
		return label;
	}

	public static FlowPage createFlowedText(String text) {
		FlowPage flowPage = new FlowPage();

		TextFlow textFlow = new TextFlow();
		textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
		textFlow.setText(text);
		flowPage.add(textFlow);

		return flowPage;
	}

}
